<?php
	class Genre extends CI_Model
	{
		public function __construct()
		{
			$this->load->database();
		}
		
		public function get_genre()
		{
			$query = $this->db->get('genres');
			return $query->result();
		}
		
		public function get_genre_with_album($genre)
		{			
			$query = $this->db->query("SELECT g.Name, a.AlbumId, a.Title
								FROM genres g, albums a
								WHERE g.GenreId = a.GenreId
								AND g.Name = '$genre'");
			return $query->result();
		}
	
		public function get_id_title_genre()
		{
			$this->db->select('GenreId,Name');
			$query = $this->db->get('genres');
			return $query->result();
		}		
	}
?>